<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>

<spring:url value="/app/public/post/search/" var="search_post_url"/>
<spring:url value="/app/public/post/refresh" var="refresh_url"/>

<div>
		<form class="formPosts" action="${search_post_url}" method="post">
			<input type="hidden" name="searchingKeyword" value="dog"/>
			<input type="submit" value="Dog">
		</form>
		<form class="formPosts" action="${search_post_url}" method="post">
			<input type="hidden" name="searchingKeyword" value="cat"/>
			<input type="submit" value="Cat">
		</form >
		<form class="formPosts" action="${search_post_url}" method="post">
			<input type="hidden" name="searchingKeyword" value="dog, cat"/>
			<input type="submit" value="Dog or Cat">
		</form>
		<input type="hidden" value="${searchingKeyword}" id="searchingKeyword">
		<div class="clearFormPost"></div>	
		<div class="refresh">
				<input type="button" value="push to refresh" id="btnRefresh">
		</div>
	</div>
	<table id="tblResult" class="table-border">
		<tbody>
			<c:forEach items="${posts}" var="item">
				<tr><td><div><img src="${item.profileImageUrl}"/></div></td><td><div>${item.name}</div></td><td><div>${item.text}</div></td></tr>
			</c:forEach>
		</tbody>
	</table>
	
<script src="<spring:url value="/resources/js/jquery-1.11.1.min.js" />"></script>
<script src="<spring:url value="/resources/js/posts.js" />"></script>	
	<script type="text/javascript">
		$(document).ready(function(){
			
			var eventData = {
					url: '${refresh_url}',
					searchingKeyword: $("#searchingKeyword").val()
				};
			$("#btnRefresh").bind("click", eventData, dvpublic.posts.refresh);			
			});
	</script>